import Vue from "vue";
import VueRouter from "vue-router";
const Home = () => import('../pages/Home')
const Login = () => import('../pages/Login')
const Movie = () => import('../pages/Home/Movie')
const Music = () => import('../pages/Home/Music')
const Games = () => import('../pages/Home/Games')
const Subject = () => import('../pages/Home/Subject')
Vue.use(VueRouter)

export default new VueRouter({
    routes:[
        {
            path:'/home',
            component:Home,
            children:[
                {path:'music/:id/:time?',component:Music,name:'music',props:true},
                {path:'movie',component:Movie,name:'movie'},
                {path:'games',component:Games,name:'games',props:(route) => {
                    return {...route.query,...route.meta}
                },meta:{
                    hot:'我永远热爱游戏',
                    isIcon:true
                }
                },
                {path:'subject',component:Subject,name:'subject',props:(route) => {
                    return {...route.query,...route.params}
                }},
                {path:'/',redirect:'/home/movie'}
            ]
        },
        {path:'/login',component:Login},
        {path:'/',redirect:'/home'}
    ]
})